#pragma once
#include <boost/test/included/unit_test.hpp>
#include <fmt/fmt.h>
#include "../include/sh/algorithm.hpp"
#include "../include/sh/threadpool.hpp"

BOOST_AUTO_TEST_SUITE(THREADPOOL_TEST)

BOOST_AUTO_TEST_CASE(threadpool_test_module) {
    fmt::println("threadpool_test_module");

    sh::ThreadPool pool;
    fmt::println("maxCount : {}", pool.maxThreadCount());
    fmt::println("active: {}", pool.activeThreadCount());

    pool.tryStart([](){ fmt::println("task"); sh::sleep_ms(100); });
  
    fmt::println("active: {}", pool.activeThreadCount());

    sh::sleep_ms(1200);

    fmt::println("active: {}", pool.activeThreadCount());
}

BOOST_AUTO_TEST_CASE(threadpool_test_end) {
    fmt::println("threadpool_test_end");
    getchar();
}

BOOST_AUTO_TEST_SUITE_END()
